package com.wms.controller;

import com.wms.dto.ConfirmDateTiemDto;
import com.wms.dto.ConfirmUnloadTiemDto;
import com.wms.pojo.PageResult;
import com.wms.pojo.Result;
import com.wms.service.WarehousingEntryDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/warehousingentry/details")
public class WarehousingEntryDetailsController {

    @Autowired
    private WarehousingEntryDetailsService detailsService;

    @GetMapping
    public Result queryPage(Integer page,Integer pageSize,String supplierName){
        PageResult pageResult = detailsService.queryPage(page,pageSize,supplierName);
        return Result.success(pageResult);
    }

    @PutMapping
    public Result updateById(@RequestBody ConfirmDateTiemDto dto){
        detailsService.updateByIdStatus(dto);
        return Result.success();
    }

    //卸货查询
    @GetMapping("/unload")
    public Result queryUnloadPage(Integer page,Integer pageSize,String supplierName){
        PageResult pageResult = detailsService.queryUnloadPage(page,pageSize,supplierName);
        return Result.success(pageResult);
    }

    //卸货修改状态
    @PutMapping("/unload")
    public Result updateUnloadById(@RequestBody ConfirmUnloadTiemDto dto){
        detailsService.updateUnloadById(dto);
        return Result.success();
    }

    //查询明细
    @GetMapping("/details")
    public Result getDetailsAll(Integer page,Integer pageSize,String supplierName){
        PageResult pageResult = detailsService.getDetailsAll(page,pageSize,supplierName);
        return Result.success(pageResult);
    }
}
